<div class="layui-form" lay-filter="layuiadmin-form-admin" id="layuiadmin-form-admin" style="padding: 20px 30px 0 0;">
    <div class="layui-form-item">
        <label class="layui-form-label">父级</label>
        <div class="layui-input-block" id="permission-select-dom"></div>
    </div>
    <div class="layui-form-item">
        <label class="layui-form-label">名称</label>
        <div class="layui-input-block">
            <input type="text" name="name" required placeholder="请输入控制器方法" autocomplete="off"
                   class="layui-input">
        </div>
    </div>
    <div class="layui-form-item">
        <label class="layui-form-label">状态</label>
        <div class="layui-input-block">
            <input type="radio" name="status" value="1" title="开启" checked>
            <input type="radio" name="status" value="0" title="禁用">
        </div>
    </div>
    <div class="layui-form-item layui-hide">
        <input type="button" lay-submit lay-filter="LAY-user-back-submit" id="LAY-user-back-submit" value="确认">
    </div>
</div>
<script type="text/html" id="permission-select">
    <select name="pid" lay-filter="type">
        <option value="0">无</option>
        {{# layui.each(d.list, function(index, item) { }}
        <option value="{{item.value}}">{{item.name}}</option>
        {{# });}}
    </select>
</script>
<script src="/static/layuiadmin/layui/layui.js"></script>
<script>
    layui.config({
        base: '/static/admin/' //静态资源所在路径
    }).extend({
        index: 'lib/index', //主入口模块
    }).use(['index', 'form', 'authtree', 'laytpl'], function () {
        var $ = layui.$, form = layui.form, authtree = layui.authtree, laytpl = layui.laytpl;
        $.ajax({
            url: "{:url('file/select')}",
            dataType: 'json',
            success: function (data) {
                var selectList = authtree.treeConvertSelect(data.trees, {
                    childKey: 'list',
                    primaryKey: 'id',
                    parentKey: 'parent_id',
                });
                laytpl($('#permission-select').html()).render({
                    list: selectList,
                }, function (html) {

                    $('#permission-select-dom').append(html);
                });
                form.render('select');

            }
        });

    });
</script>